package com.woniu;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;

public class AotuMPHealthyApp {

    public static void main(String[] args) {

        FastAutoGenerator.create(
                        //编写 url username password ，使生成器可以连接数据库读取相关信息
                        "jdbc:mysql://120.24.36.39:3306/alihealthy",
                        "root",
                        "123456")

                // 全局配置
                .globalConfig(builder -> {
                    builder.author("lwh") // 设置作者
                            .outputDir("/Users/nenxiangjiao/Desktop/JAVA课程/aliHealthy/src/main/java"); // 指定输出目录
                })
                // 包配置
                .packageConfig(builder -> {
                    builder.parent("com.woniu.healthy") // 设置父包名
                            .controller("controller")
                            .service("service")
                            .serviceImpl("service.impl")
                            .mapper("mapper")
                            .xml("healthyMapper")
                            .entity("bean");
                })
                //表的配置  9
                .strategyConfig(builder -> {
                    builder.addInclude("blood").addInclude("blood_glucose").addInclude("sport").addInclude("temperature")
                            .addInclude("user").addInclude("heart").addInclude("walk").addInclude("weight")
                            .addInclude("sleep"); // 设置需要生成的表名
                })
                // 使用Freemarker引擎模板，默认的是Velocity引擎模板
                .templateEngine(new FreemarkerTemplateEngine())
                .execute();
        System.out.println("成功了...");
    }

}